package com.taichuan.selfcheck.ui.adapter;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.taichuan.selfcheck.R;
import com.taichuan.selfcheck.entity.TestResultEntity;

import java.util.List;

public class TestResultAdapter extends BaseQuickAdapter<TestResultEntity, BaseViewHolder> {
    public TestResultAdapter(@Nullable List<TestResultEntity> data) {
        super(R.layout.item_test_result,data);
    }

    @Override
    protected void convert(BaseViewHolder helper, TestResultEntity item) {
        helper.setText(R.id.test_function,item.getTestContent());
        if (1==item.getTestResult()){
            helper.setTextColor(R.id.test_result,0xff00FF00);   //绿色
            helper.setText(R.id.test_result,"正常");
        }else if (2==item.getTestResult()){
            helper.setText(R.id.test_result,"异常");
            helper.setTextColor(R.id.test_result,0xffFF0000);   //红色
        }else {
            helper.setText(R.id.test_result,"未测试");
            helper.setTextColor(R.id.test_result,0xffFFFFFF);   //黑色
        }

    }
}
